<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>login_checkPic_frame</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style type="text/css">
        .resetSection{
          padding: 0px 0 4px;
          background: url(../../image/reset@2x.png) no-repeat center;
          background-size:100% 100%;
        }
        .titleNum,.existNum{
          text-align: center;
        }
        .titleNum{
              font-size: 14px;
          margin: 41px 0 11px 0;
        }
        .existNum{
          font-size: 19px;
          line-height: 19px;
          margin-bottom: 71px;
        }
        .aui-list .aui-list-item {
            margin: 0 0 0px 28px;
            height: 56px;
            line-height: 56px;
            padding-left: 0;
            border-bottom: 1px solid rgba(204, 204, 204, .2);
            background-image: -webkit-linear-gradient(90deg, rgba(221, 221, 221, 0), rgba(221, 221, 221, 0) 50%, transparent 50%);
            background-image: linear-gradient(90deg, rgba(221, 221, 221, 0), rgba(221, 221, 221, 0) 50%, transparent 50%);
        }

        @media screen and (-webkit-min-device-pixel-ratio: 1.5) {
            .aui-list {
                background-image: linear-gradient(90deg, rgba(221, 221, 221, 0), rgba(221, 221, 221, 0) 50%, transparent 50%);
            }
        }
        .login-input {
            text-indent: 5px;
            letter-spacing: 2px;
            font-size: 17px!important;
        }
        .getVilidCode {
            font-size: 17px;
            color: #141414 !important;
            background-color: rgba(255, 255, 255, 0)!important;
        }
        .subBtnse{
              margin-top: 203px;
        }
        .subBtn {
            margin: 0 auto;
            height: 40px!important;
            line-height: 40px!important;
            width: 245px;
            background: url(../../image/sure@2x.png) no-repeat center;
            background-size: 100%;
            background-color: rgba(255, 255, 255, 0) !important;
        }

        /*适配屏幕320px*/
        @media (max-width: 320px){
          .resetSection .aui-col-xs-3 {
              height: 80px;
          }
          .resetSection .aui-col-xs-3 img {
              padding: 3px 0 0 3px;
          }
          .padding-R {
              padding-right: 3px!important;
          }
          .resetSection {
              padding: 0px 0 3px;
          }
          .aui-list .aui-list-item,
          .login-input,
           .getVilidCode,
           .loginOpert .creatOrforget {
              font-size: 12px!important;
          }
          .subBtn {
              height: 27px!important;
              line-height: 27px!important;
              width: 163px;
          }
          .titleNum{
            margin:27px 0 7px 0;
          }
          .existNum{
                margin-bottom: 47px;
          }
          .subBtnse {
              margin-top: 136px;
          }
      	}

        /*适配屏幕320px*/
    </style>
</head>
<body>
    <section class="aui-content aui-margin-b-10 resetSection" id="resetPwdPage" v-bind:style="{height:wHeight}">
         <p class="titleNum">当前手机号</p>
         <h1 class="existNum">{{showExsitPhone}}</h1>
         <ul class="aui-list aui-form-list ">
           <li class="aui-list-item">
               <div class="aui-list-item-label color-orange">
                   验证码
               </div>
               <div class="aui-list-item-inner">
                   <div class="aui-list-item-input aui-padded-l-10" style="padding-right: 0;">
                       <input type="text"  placeholder="请输入验证码"  ref="validateCode" id="" class="login-input" v-on:change="getVilidCodeValue()">
                       <!-- pattern="^1[345678][0-9]{9}$" -->
                   </div>
                   <div class="aui-list-item-label aui-margin-r-15" style="width: 8rem;" v-on:click="getValidateCode()">
                       <div class="aui-btn aui-btn-info getVilidCode" style="width: 7.5rem;">{{getText}}</div>
                   </div>
               </div>
           </li>
             <li class="aui-list-item">
                 <div class="aui-list-item-label  color-orange">
                     密码
                 </div>
                 <div class="aui-list-item-inner">
                     <div class="aui-list-item-input aui-padded-l-10">
                         <input type="password" placeholder="请输入新密码" ref="password" id=""  class="login-input"  v-on:change="getPasswordValue()">
                                      <!-- pattern="[0-9]*" -->
                     </div>
                 </div>
             </li>
         </ul>
         <section class="aui-content-padded subBtnse">
             <div class="aui-btn aui-btn-block aui-btn-info aui-btn-sm subBtn" v-on:click="loginOperate()"></div>
         </section>
    </section>
  </body>
<script type="text/javascript" src="../../script/api.js" ></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/fastclick.js"></script>
<script type="text/javascript">
    apiready = function () {
      api.parseTapmode();
    }
    ////初始化页面
    var app = new Vue({
        el: '#resetPwdPage',
        data: {
            showExsitPhone : '',
            exsitPhone:'',
            wHeight: '',
            password : '',
            validateCode : '',
            getText : '点击获取'
        },
        methods: {
            init: function() {
              /////初始化页面高度
                var wh = document.documentElement.clientHeight || document.body.clientHeight;
                var _resetPhone = $api.getStorage('resetPhone', this.phoneNum);////手机加密码页面传来手机号
                    this.wHeight = (wh) + 'px';
                    this.exsitPhone = $api.getStorage('resetPhone', this.phoneNum);////手机加密码页面传来手机号
                    this.showExsitPhone  = _resetPhone.replace(_resetPhone.substr(3,4), "****");/////显示带星号号码
            },
            /////点击获取的验证码
            getValidateCode : function(){
               this.validateCode = this.$refs.validateCode.value;
               login.getValidateCodeMethod();
            },
            /////输入密码获得值
            getPasswordValue : function(){
               this.password = this.$refs.password.value;
            },
            /////输入验证码值
            getVilidCodeValue : function(){
               this.validateCode = this.$refs.validateCode.value;
            },
              /////点击登录按钮
            loginOperate : function(){
               login.loginOperateMethod();
            }
        },
        mounted:function(){
            this.init();
        }
    });
    //////登录
    var login = {
      //////获取验证码请求
        getValidateCodeMethod : function(){
          login.getValidateCodeCountTime();//////开始计时
          $c.ajax({
              url: 'http://dev-m-api.jiucaig.com/index.php?l=zh-cn&s=/Api/Login/sendResetVerificationCode',////手机号获取验证码/////成功调用
              method:'post',
              values:{
                  phone: app.exsitPhone
              },
              success: function(ret) {
              //  bf_common_view.bf_win.popToast("正在发送验证码!");
                //console.log(JSON.stringify(ret));
                  if(ret) {
                      bf_common_view.bf_win.popToast("验证码发送成功!");
                  }

              },
              err:function(err){
                bf_common_view.bf_win.popToast("发送失败！");
                //console.log(JSON.stringify(err));
              }
          });
        },
        ////点击确认按钮操作
        loginOperateMethod : function(){
            $c.ajax({
                url: 'http://dev-m-api.jiucaig.com/index.php?l=zh-cn&s=/Api/Login/resetPassword',////手机号加密码登录/////成功调用
                method:'post',
                values:{
                    //countryCode : app.countryCode,
                    phone : app.exsitPhone,
                    password :  app.password,//////密码
                    code : app.validateCode/////验证码
                },
                success: function(ret) {
                    //console.log(JSON.stringify(ret))
                    if(ret) {
                      bf_common_view.bf_win.popToast("修改成功！");
                         setTimeout(function(){
                             api.closeWin();
                         },1000)
                    }
                },
                err:function(err){
                  bf_common_view.bf_win.popToast("修改失败！");
                  //console.log(JSON.stringify(err));
                }
            });
        },
        ////获取验证码倒计时
        getValidateCodeCountTime : function(){
             var _countTime = 30;
             var clock =  setInterval(function(){////定时器
               time();
             },1000)
             function time(){
                   if (_countTime == 0) {
                     /////清除定时器
                     clearInterval(clock);
                      app.getText = "点击获取";
                      _countTime = 30;
                   } else {
                      app.getText = _countTime +'s';
                      _countTime--;
                   }
            }
        }
    };
</script>
</html>
